package com.weiiew.backend.operation;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.awt.*;

/**
 * @Description 鼠标滚轮事件
 * @Author 魏锴
 * @Date 2025/4/26
 */
@Setter
@Getter
@ToString
@AllArgsConstructor
public class MouseWheelScroll extends ComputerOperation {
    private static final long serialVersionUID = 121204894517L; // 添加 serialVersionUID
    private final int units;

    public MouseWheelScroll(long timestamp, String desc) {
        super.setTimestamp(timestamp);
        this.units = Integer.parseInt(desc);
    }

    public MouseWheelScroll(int units, long timestamp) {
        this.units = units;
        super.setTimestamp(timestamp);
    }

    @Override
    public String toDescriptionString() {
        return String.format("wc@%d@%d", this.getTimestamp(), units);
    }

    @Override
    public void execute(Robot robot) {
        robot.mouseWheel(units);
    }

}